#ifndef GLOBALDATA_H
#define GLOBALDATA_H

#include <QString>
#include <QObject>
#include <QGSettings>
#include <QFont>

#define THEME_GSETTINGS "org.ukui.style"
#define APPLY_FONT_KEY "system-font"
#define APPLY_HIGHT_LIGHT_COLOR "theme-color"
// 主题
#define LIGHT_THEME "ukui-default"
#define BLACK_THEME "ukui-dark"

class GlobalData : public QObject
{
    Q_OBJECT
public:
    static GlobalData *getInstance();
    ~GlobalData();

    /* 获取主题的样式，字号，透明度 */
    void getSystemTheme();
    void getSystemFontSize();
    void getSystemTransparency();
    void getSystemFontName();
    QFont getFontSize12px();
    QFont getFontSize14px();
    QFont getFontSize16px();
    QFont getFontSize18px();
    QString getThemeData();
    double getTransparencyData();
    QString getFontNameData();

    /* SDK功能打点 */
    static void SDKPointFileUpload();
    static void SDKPointFileCopy();
    static void SDKPointJumpOfficicalWebsite();
    static void SDKPointJumpOnlineService();
    
private:
    // 主题色
    QString m_systemTheme;

    double m_transparency;   /* 毛玻璃透明度 */
    double m_fontSize;       /* 字号 */

    /* 字体监控 */
    double m_font12pxToPt;
    double m_font14pxToPt;
    double m_font16pxToPt;  
    double m_font18pxToPt; 

    QString m_fontName = "";
    QGSettings *m_themeGsettings = nullptr;

signals:
    void sigFontSizeChange();
    void sigFontNameChange();
    void sigTransparency();
    void sigTheme();
private:
    GlobalData();
    void changeFontSize();
    void changeTheme();
    void changeTransparency();
};

#endif 